<!DOCTYPE html>
<html>
    <head>
        <meta name="layout" content="main"/>

		<asset:javascript src="jquery" />
		<asset:javascript src="spring-websocket" />

        <script type="text/javascript">
            (function() { 
                var socket = new SockJS("${createLink(uri: '/stomp')}");
                //alert("${createLink(uri: '/stomp')}");
                var client = Stomp.over(socket);
				
                //client.connect({}, function() {
                client.connect("webGuest", "passcode", function() {
                    client.subscribe("/topic/invitation", function(message) {
                        $("#helloDiv").append(message.body);
                    });
                });

                $("#helloButton").click(function() {
                    client.send("/app/hello", {}, JSON.stringify({'hello' : $("#helloMsg").val() })); 
                });//{"content-type": "text/plain"}, $("#helloButton").value);
            });
        </script> 
    </head>
    <body>
    	<input id="helloMsg" value="default msg">
        <button id="helloButton">hello</button>
        <div id="helloDiv"></div>
    </body>
</html>